$(function (){
    lunbo("#banner",420,1000,420)
    lunbo(".slider",340,430,340)
    lunbo(".bookslider",220,334,220)
    
    $(".branch").mouseenter(function(){
        console.log(1);
        // $(this).prop('checked',true).closest('.extension').find('.switch').eq($(this).index()).addClass('current').siblings('.switch').removeClass('current')
        $(this).prop('checked',true).closest('.extension').find('.switch').eq($(this).index()).css('display','block').siblings('.switch').css('display','none')
    })
    let colorArr = ["#93d46f", "#f65828", "#bb9dee", "#ff7394", "#c2ec52"]
    $('.body-nav-item .list').mouseenter(function(){
        let index=$(this).index()
        $(this).css({"background-position-x":"-40px","background-color":colorArr[index],'width':40}).siblings().css({'background-position-x':'',"background-color":'','width':0})
    }).click(function(){
        /*给每个大块加上导航索引floor*/
        /*获取当前点击索引*/
        let index=$(this).index()
        /*因为点击的索引对应导航索引floor,所以可以获取当前对应的floor*/
        let $target=$(".floor").eq(index)
        /*获取到对应的floor索引，判断它到窗口的距离*/
        let sTop=$target.offset().top
        /*将距离赋给浏览器。通过浏览器到对应floor位置*/
        // $('html,body').animate({scrollTo:sTop},300)
        $("html,body").stop().animate({ scrollTop: sTop }, 300) 
        
    })
    $(window).scroll(function(){
        let stop=$("html,body").scrollTop()
        console.log(stop);
        if(stop>500){
            $('.allsearch').css('display','block')
            $('.searchre').appendTo('.allsearch .container')
        }else{
            $('.allsearch').css('display','none')
            $('.searchre').appendTo(".searchreturn")
        }
    })

})
